package com.kantboot.system.user.dao.repository.entity;

import com.kantboot.system.user.domain.dto.ThirdPartyLoginDTO;
import com.kantboot.system.user.domain.entity.SysUserThirdParty;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface SysUserThirdPartyRepository extends JpaRepository<SysUserThirdParty,Long> {

    /**
     * 查询第三方用户
     */
    @Query("""
            FROM SysUserThirdParty t
            WHERE t.thirdPartyCode = :#{#param.thirdPartyCode}
            AND t.key = :#{#param.key}
            AND t.value = :#{#param.value}
            """)
    SysUserThirdParty find(@Param("param")ThirdPartyLoginDTO param);

    List<SysUserThirdParty> findByUserId(Long userId);

}
